#pragma once

#include "cData.h"

#define SCENE_WIDTH		28
#define SCENE_DEPTH		28
#define SCENE_HEIGHT	1.5
#define SKYBOX_SIZE		15

#define TILE_SIZE		4	//space units

#define FILENAME		"level"
#define FILENAME_EXT	".txt"


class cScene
{
public:
	cScene(void);
	virtual ~cScene(void);

	void Init();
	bool LoadLevel(int level);
	void Draw(cData *Data);
	int *GetMap();
	void SetOpeningDoor(bool b);
	void SetOut(bool b);
	void Dijkstra(int txini, int tzini, int txfi, int tzfi, int &nextX, int &nextZ);
	void UpdateDist(int x, int y, float newDist, float &dist, int &id);
	bool UpdateMin(int tx, int tz, float &min, int &mintx, int &mintz);
	GLuint programID;

private:
	void MakeCubeDL(float w,float h,float d,float tw,float th,float td);
	void MakeCubeDL2(float w,float h,float d,float tw,float th,float td);
	void MakeCubeDL3(float w,float h,float d,float tw,float th,float td);
	void MakeFace(float w,float h,float d,float tw,float th,float td);
	void MakeRamp(float w,float h,float d,float tw,float th,float td);
	void MakeFloor(float w,float h,float d,float tw,float th,float td);
	void MakeSkyBox(cData *Data);
	void DrawDoor(cData *Data);
	int dl_cube;
	int dl_cube2;
	int dl_cube3;
	int dl_face;
	int dl_floor;
	int dl_ramp;

	int map[SCENE_WIDTH * SCENE_DEPTH];		//scene
	float doorRotate;
	bool openingDoor;
	bool out;
	float dist[SCENE_WIDTH][SCENE_DEPTH];
	bool visitat[SCENE_WIDTH][SCENE_DEPTH];
};
